package framework.view {
	import flash.events.Event;
	import org.robotlegs.mvcs.Mediator;

	/**
	 * @author Charlie MacIsaac
	 */
	public class CoreMediator extends Mediator {
		// PROPERTIES =============================================================================
		[Inject]	public var view : CoreRobotlegs;
		
		private var _canvas : BlitCanvasView;
		private var _body : BlitDisplayObjectView;
		
		// GETTERS + SETTERS ======================================================================
		// CONSTRUCTOR ============================================================================
		public function CoreMediator() { }
		
		// PUBLIC =================================================================================
		override public function onRegister() : void {
			super.onRegister();
			
			_canvas = new BlitCanvasView();
			view.addChild(_canvas);
			_canvas.enterFrameSignal.add(canvasEnterFrameHandler);
			
			view.addChild(new Profiler());
			
			_body = new BlitDisplayObjectView("BodySkin");
			_body.x = _body.y = 10;
			mediatorMap.createMediator(_body);
		}
		
		// PRIVATE ================================================================================
		// LISTENERS ==============================================================================
		private function canvasEnterFrameHandler(e : Event) : void {
			_body.rotation -= 0.05;
			_body.x += 1;
			_body.y += 1;
		}
	}
}